<script setup>
const prop = defineProps({
    car: String,
    changeCarCb: Function
})
console.log(prop.car);
const emit = defineEmits(['changeCar'])
</script>

<template>
    <div style="width: 300px; height: 200px; border: 10px solid #ff0000">
        子组件
        <div>车: {{ car }}</div>
        <button @click="emit('changeCar', '劳斯莱斯')">换车</button>
    </div>
    <button @click="changeCarCb('宝马')">我也换车！</button>
</template>

<style scoped></style>